
CREATE TABLE [dbo].[News](
	[IdNews] [bigint] IDENTITY(1,1) NOT NULL,
	[IdUserCreation] [bigint] NOT NULL,
	[DateCreation] [datetime2](7) NOT NULL,
	[Enabled] [bit] NOT NULL,
	[IdEstablishment] [bigint] NULL,
	[Message] [varchar](max) NOT NULL,
 CONSTRAINT [PK_News] PRIMARY KEY CLUSTERED 
(
	[IdNews] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO

ALTER TABLE [dbo].[News] ADD  CONSTRAINT [DF_News_DateCreation]  DEFAULT (getdate()) FOR [DateCreation]
GO

ALTER TABLE [dbo].[News] ADD  CONSTRAINT [DF_News_Enabled]  DEFAULT ((0)) FOR [Enabled]
GO

ALTER TABLE [dbo].[News]  WITH CHECK ADD  CONSTRAINT [FK_News_Users] FOREIGN KEY([IdUserCreation])
REFERENCES [dbo].[Users] ([IdUser])
GO

ALTER TABLE [dbo].[News] CHECK CONSTRAINT [FK_News_Users]
GO

ALTER TABLE dbo.News add Title varchar(256) NOT NULL;



